Now that we have deobfuscated the code, we can start going through it:
Code: javascript 'use strict'; function generateSerial() { ...SNIP... var xhr = new XMLHttpRequest; var url = "/serial.php"; xhr.open("POST", url, true); xhr.send(null); };
We see that the secret.js file contains only one function, generateSerial.
Let us look at each line of the generateSerial function.
So, all generateSerial is doing is simply sending a POST request to /serial.php, without including any POST data or retrieving anything in return.
The developers may have implemented this function whenever they need to generate a serial, like when clicking on a certain Generate Serial button, for example. However, since we did not see any similar HTML elements that generate serials, the developers must not have used this function yet and kept it for future use.
With the use of code deobfuscation and code analysis, we were able to uncover this function. We can now attempt to replicate its functionality to see if it is handled on the server-side when sending a POST request. If the function is enabled and handled on the server-side, we may uncover an unreleased functionality, which usually tends to have bugs and vulnerabilities within them.